home *** CD-ROM | disk | FTP | other *** search
- Path: colt-74.slip.uiuc.edu!user
- From: bwood@uiuc.edu (Brett Wood)
- Newsgroups: comp.lang.c
- Subject: Re: Help with simple code
- Date: Tue, 16 Jan 1996 15:49:15 -0600
- Organization: University of Illinois
- Message-ID: <bwood-1601961549150001@colt-74.slip.uiuc.edu>
- References: <4dbak5$oij@ionews.io.org> <tcpnntpd.16.1.16.0.51.40.2781597121.342670@the-fix.sos.on.ca>
- NNTP-Posting-Host: colt-74.slip.uiuc.edu
-
- In article <tcpnntpd.16.1.16.0.51.40.2781597121.342670@the-fix.sos.on.ca>,
- <verneb@the-fix.sos.on.ca> wrote:
-
- > I >Can anyone tell me what's wrong with this piece of code? I lifted it
- > I >straight from a textbook.
- > I >
- > I >Here's the code:
- > I >
- > I >/* Calculating compound interest */
- > I >..h>
- > I >..h>
- > I >
- > I >main()
- > I >{
- > I > int year;
- > I > double amount, principal = 1000, rate = 0.5;
- > I >
- > I > printf("%4s%21s\n", "Year", "Amount on deposit");
- > I >
- > I > for (year = 1; year <= 10; year++) {
- > I > amount = principal * pow(1.0 + rate, year);
- > I > printf("%4d%21.2f\n", year, amount);
- > I > }
- > I >
- > I > return 0;
- > I >}
- > I >______________________________________________________________
- > I >
- > I >and here's the error:
- > I >
- > I >In function `main':
- > I >undefined reference to `pow'
- > I >
- > I >I don't understand. `pow' is a function, not a variable?
- > I >Can anyone tell me what's wrong?
- > I >
-
- Did you #include <math.h> ??
-